<#assign base=request.contextPath>
<!DOCTYPE html> 
<html>
	<head>
		<title>${title}</title>
		<meta charset="utf-8">
		<#include "common/reference.ftl" />
		<#include "common/am.reference.ftl" />
	</head>
	<body class="${configs["skinName"]}">
		<div class="page-content">
			<div class="row">
			<#include "common/breadcrumb.ftl">
				<form id="form" role="form" class="form-horizontal" method="post" action="${base}/${form_action}">
					<div class="col-xs-12">
						<div class="widget-box">
							<div class="widget-body">
								<input type="hidden" name="orderNo" id="orderNo" value="${model.orderNo}" <#if viewMode == "view">disabled</#if>>
								<div class="alert alert-warning">
									<strong>提示!</strong>
									<strong style="color:#dd514c;">出现红框</strong>的表示不能为空
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										订单号
									</label>
									<div class="col-sm-6">
										${model.orderNo}
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										订单状态
									</label>
									<div class="col-sm-6">
										<select id="status" name="status" class="chosen-select form-control">
											<option value="2">接单</option>
											<option value="4">拒单</option>
										</select>
									</div>
								</div>
								<div id="divDelivery" style="display:block">
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right">
											配送人
										</label>
										<div class="col-sm-6">
											<input type="text" id="deliveryPerson" name="deliveryPerson" value="${model.deliveryPerson}" class="form-control" placeholder="请输入配送人" <#if viewMode == "view">disabled</#if>>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right">
											配送人电话
										</label>
										<div class="col-sm-6">
											<input type="text" id="deliveryPhone" name="deliveryPhone" value="${model.deliveryPhone}" class="form-control" placeholder="请输入配送人电话" <#if viewMode == "view">disabled</#if>>
										</div>
									</div>
								</div>
								<div class="clearfix form-actions">
									<div class="col-md-offset-3 col-md-9">
										<button id="btnSubmit" class="btn btn-info" type="button">
											<i class="fa fa-check bigger-110"></i>
											提 交
										</button>
									</div>
								</div>
							</div>
						</div>
					</div>
				</form>
			</div>	
		</div>
		<script type="text/javascript">
		$(function(){
			$('#status').change(function(){
				var value = $(this).val();
				if(value == 2){
					$('#divDelivery').show();
				}
				else{
					$('#divDelivery').hide();
				}
			})
			$('.chosen-select').chosen();
			$('#form').validator();
			$('#btnSubmit').click(function(){
				var value = $('#status').val();
				var tip = value == 2 ? '接单' :'拒单';
				if(value == 2){
					var deliveryPerson = $('#deliveryPerson').val();
					var deliveryPhone = $('#deliveryPhone').val();
					if(!deliveryPerson){
						layer.alert('接单请设置配送员')
						return;
					}
					if(!deliveryPhone){
						layer.alert('接单请设置配送员电话')
						return;
					}
				}
				layer.confirm('请认真核对订单信息，确定'+tip+'吗？',function(){
					$('#form').submit();
				})
			})
		})
		</script>
	</body>
</html>